<?php
define("EW_PAGE_ID", "search", TRUE); // Page ID
define("EW_TABLE_NAME", 'osj-users', TRUE);
?>
<?php 
session_start(); // Initialize session data
ob_start(); // Turn on output buffering
?>
<?php include "osj-ewcfg50.php" ?>
<?php include "osj-ewmysql50.php" ?>
<?php include "osj-phpfn50.php" ?>
<?php include "osj-osj2dusersinfo.php" ?>
<?php include "osj-userfn50.php" ?>
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified
header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1 
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
?>
<?php

// Open connection to the database
$conn = ew_Connect();
?>
<?php
$Security = new cAdvancedSecurity();
?>
<?php
if (!$Security->IsLoggedIn()) $Security->AutoLogin();
$Security->LoadCurrentUserLevel('osj-users');
if (!$Security->IsLoggedIn()) {
	$Security->SaveLastUrl();
	Page_Terminate("osj-login.php");
}
if (!$Security->CanSearch()) {
	$Security->SaveLastUrl();
	Page_Terminate("osj-osj2duserslist.php");
}
if ($Security->IsLoggedIn() && $Security->CurrentUserID() == "") {
	$_SESSION[EW_SESSION_MESSAGE] = "You do not have the right permission to view the page";
	Page_Terminate("osj-login.php");
}
?>
<?php

// Common page loading event (in userfn*.php)
Page_Loading();
?>
<?php

// Page load event, used in current page
Page_Load();
?>
<?php
$osj2Dusers->Export = @$_GET["export"]; // Get export parameter
$sExport = $osj2Dusers->Export; // Get export parameter, used in header
$sExportFile = $osj2Dusers->TableVar; // Get export file, used in header
?>
<?php

// Get action
$osj2Dusers->CurrentAction = @$_POST["a_search"];
switch ($osj2Dusers->CurrentAction) {
	case "S": // Get Search Criteria

		// Build search string for advanced search, remove blank field
		$sSrchStr = BuildAdvancedSearch();
		if ($sSrchStr <> "") {
			Page_Terminate("osj-osj2duserslist.php?" . $sSrchStr); // Go to list page
		}
		break;
	default: // Restore search settings
		LoadAdvancedSearch();
}

// Render row for search
$osj2Dusers->RowType = EW_ROWTYPE_SEARCH;
RenderRow();
?>
<?php include "osj-header.php" ?>
<script type="text/javascript">
<!--
var EW_PAGE_ID = "search"; // Page id
var EW_SHOW_HIGHLIGHT = "Show highlight"; 
var EW_HIDE_HIGHLIGHT = "Hide highlight";

//-->
</script>
<script type="text/javascript">
<!--

function ew_ValidateForm(fobj) {
	if (fobj.a_confirm && fobj.a_confirm.value == "F")
		return true;
	var i, elm, aelm, infix;
	var rowcnt = (fobj.key_count) ? Number(fobj.key_count.value) : 1;
	for (i=0; i<rowcnt; i++) {
		infix = (fobj.key_count) ? String(i+1) : "";
		elm = fobj.elements["x" + infix + "_user_email"];
		if (elm && !ew_CheckEmail(elm.value)) {
			if (!ew_OnError(elm, "Users  must provide a valid email address."))
				return false; 
		}
	}
	return true;
}

//-->
</script>
<script type="text/javascript">
<!--
var ew_DHTMLEditors = [];

//-->
</script>
<script type="text/javascript">
<!--

// js for Popup Calendar
//-->

</script>
<script language="JavaScript" type="text/javascript">
<!--

// Write your client script here, no need to add script tags.
// To include another .js script, use:
// ew_ClientScriptInclude("my_javascript.js"); 
//-->

</script>
<p><span class="phpmaker">Search TABLE: Users<br><br><a href="osj-osj2duserslist.php">Back to List</a></span></p>
<form name="fosj2Duserssearch" id="fosj2Duserssearch" action="osj-osj2duserssrch.php" method="post" onSubmit="return ew_ValidateForm(this);">
<p>
<input type="hidden" name="a_search" id="a_search" value="S">
<table class="ewTable">
	<tr class="ewTableRow">
		<td class="ewTableHeader">User ID</td>
		<td<?php echo $osj2Dusers->user_id->CellAttributes() ?>><span class="ewSearchOpr">=<input type="hidden" name="z_user_id" id="z_user_id" value="="></span></td>
		<td<?php echo $osj2Dusers->user_id->CellAttributes() ?>><span class="phpmaker">
<?php if (!$Security->IsAdmin() && $Security->IsLoggedIn()) { // Non system admin ?>
<input type="hidden" name="x_user_id" id="x_user_id" value="<?php echo ew_HtmlEncode($osj2Dusers->user_id->AdvancedSearch->SearchValue) ?>">
<?php } else { ?>
<?php } ?>
</span></td>
	</tr>
	<tr class="ewTableRow">
		<td class="ewTableHeader" align="right">
			<input type="radio" name="v_user_id" id="v_user_id" value="AND"<?php if ($osj2Dusers->user_id->AdvancedSearch->SearchCondition <> "OR") echo " checked" ?>>and <span name="_v_user_id" id="_v_user_id"><input type="radio" name="v_user_id" id="v_user_id" value="OR"<?php if ($osj2Dusers->user_id->AdvancedSearch->SearchCondition == "OR") echo " checked" ?>>or</span>
		</td>
		<td<?php echo $osj2Dusers->user_id->CellAttributes() ?>><span class="ewSearchOpr" name="_w_user_id" id="_w_user_id"><select name="w_user_id" id="w_user_id"><option value="="<?php echo ($osj2Dusers->user_id->AdvancedSearch->SearchOperator2=="=")?" selected":"" ?>>=</option><option value="<>"<?php echo ($osj2Dusers->user_id->AdvancedSearch->SearchOperator2=="<>")?" selected":"" ?>><></option><option value="<"<?php echo ($osj2Dusers->user_id->AdvancedSearch->SearchOperator2=="<")?" selected":"" ?>><</option><option value="<="<?php echo ($osj2Dusers->user_id->AdvancedSearch->SearchOperator2=="<=")?" selected":"" ?>><=</option><option value=">"<?php echo ($osj2Dusers->user_id->AdvancedSearch->SearchOperator2==">")?" selected":"" ?>>></option><option value=">="<?php echo ($osj2Dusers->user_id->AdvancedSearch->SearchOperator2==">=")?" selected":"" ?>>>=</option></select></span></td>
		<td<?php echo $osj2Dusers->user_id->CellAttributes() ?>><span class="phpmaker">
<?php if (!$Security->IsAdmin() && $Security->IsLoggedIn()) { // Non system admin ?>
<input type="hidden" name="y_user_id" id="y_user_id" value="<?php echo ew_HtmlEncode($osj2Dusers->user_id->AdvancedSearch->SearchValue2) ?>">
<?php } else { ?>
<?php } ?>
</span></td>
	</tr>
	<tr class="ewTableAltRow">
		<td class="ewTableHeader">Creation Date</td>
		<td<?php echo $osj2Dusers->user_creation_date->CellAttributes() ?>><span class="ewSearchOpr">between<input type="hidden" name="z_user_creation_date" id="z_user_creation_date" value="BETWEEN"></span></td>
		<td<?php echo $osj2Dusers->user_creation_date->CellAttributes() ?>><span class="phpmaker">
</span></td>
	</tr>
	<tr class="ewTableAltRow">
		<td class="ewTableHeader" align="right">
		</td>
		<td<?php echo $osj2Dusers->user_creation_date->CellAttributes() ?>><span class="ewSearchOpr" name="_w_user_creation_date" id="_w_user_creation_date">and<input type="hidden" name="w_user_creation_date" id="w_user_creation_date" value="AND"></span></td>
		<td<?php echo $osj2Dusers->user_creation_date->CellAttributes() ?>><span class="phpmaker">
</span></td>
	</tr>
	<tr class="ewTableRow">
		<td class="ewTableHeader">Edit Date</td>
		<td<?php echo $osj2Dusers->user_edit_date->CellAttributes() ?>><span class="ewSearchOpr">between<input type="hidden" name="z_user_edit_date" id="z_user_edit_date" value="BETWEEN"></span></td>
		<td<?php echo $osj2Dusers->user_edit_date->CellAttributes() ?>><span class="phpmaker">
</span></td>
	</tr>
	<tr class="ewTableRow">
		<td class="ewTableHeader" align="right">
		</td>
		<td<?php echo $osj2Dusers->user_edit_date->CellAttributes() ?>><span class="ewSearchOpr" name="_w_user_edit_date" id="_w_user_edit_date">and<input type="hidden" name="w_user_edit_date" id="w_user_edit_date" value="AND"></span></td>
		<td<?php echo $osj2Dusers->user_edit_date->CellAttributes() ?>><span class="phpmaker">
</span></td>
	</tr>
	<tr class="ewTableAltRow">
		<td class="ewTableHeader">Email</td>
		<td<?php echo $osj2Dusers->user_email->CellAttributes() ?>><span class="ewSearchOpr">starts with<input type="hidden" name="z_user_email" id="z_user_email" value="STARTS WITH"></span></td>
		<td<?php echo $osj2Dusers->user_email->CellAttributes() ?>><span class="phpmaker">
<input type="text" name="x_user_email" id="x_user_email" title="Email"  size="30" maxlength="255" value="<?php echo $osj2Dusers->user_email->EditValue ?>"<?php echo $osj2Dusers->user_email->EditAttributes() ?>>
</span></td>
	</tr>
	<tr class="ewTableAltRow">
		<td class="ewTableHeader" align="right">
			<input type="radio" name="v_user_email" id="v_user_email" value="AND"<?php if ($osj2Dusers->user_email->AdvancedSearch->SearchCondition <> "OR") echo " checked" ?>>and <span name="_v_user_email" id="_v_user_email"><input type="radio" name="v_user_email" id="v_user_email" value="OR"<?php if ($osj2Dusers->user_email->AdvancedSearch->SearchCondition == "OR") echo " checked" ?>>or</span>
		</td>
		<td<?php echo $osj2Dusers->user_email->CellAttributes() ?>><span class="ewSearchOpr" name="_w_user_email" id="_w_user_email"><select name="w_user_email" id="w_user_email"><option value="="<?php echo ($osj2Dusers->user_email->AdvancedSearch->SearchOperator2=="=")?" selected":"" ?>>=</option><option value="<>"<?php echo ($osj2Dusers->user_email->AdvancedSearch->SearchOperator2=="<>")?" selected":"" ?>><></option><option value="<"<?php echo ($osj2Dusers->user_email->AdvancedSearch->SearchOperator2=="<")?" selected":"" ?>><</option><option value="<="<?php echo ($osj2Dusers->user_email->AdvancedSearch->SearchOperator2=="<=")?" selected":"" ?>><=</option><option value=">"<?php echo ($osj2Dusers->user_email->AdvancedSearch->SearchOperator2==">")?" selected":"" ?>>></option><option value=">="<?php echo ($osj2Dusers->user_email->AdvancedSearch->SearchOperator2==">=")?" selected":"" ?>>>=</option><option value="LIKE"<?php echo ($osj2Dusers->user_email->AdvancedSearch->SearchOperator2=="LIKE")?" selected":"" ?>>contains</option><option value="NOT LIKE"<?php echo ($osj2Dusers->user_email->AdvancedSearch->SearchOperator2=="NOT LIKE")?" selected":"" ?>>not contains</option><option value="STARTS WITH"<?php echo ($osj2Dusers->user_email->AdvancedSearch->SearchOperator2=="STARTS WITH")?" selected":"" ?>>starts with</option></select></span></td>
		<td<?php echo $osj2Dusers->user_email->CellAttributes() ?>><span class="phpmaker">
<input type="text" name="y_user_email" id="y_user_email" title="Email"  size="30" maxlength="255" value="<?php echo $osj2Dusers->user_email->EditValue2 ?>"<?php echo $osj2Dusers->user_email->EditAttributes() ?>>
</span></td>
	</tr>
	<tr class="ewTableRow">
		<td class="ewTableHeader">User Level</td>
		<td<?php echo $osj2Dusers->user_level->CellAttributes() ?>><span class="ewSearchOpr">=<input type="hidden" name="z_user_level" id="z_user_level" value="="></span></td>
		<td<?php echo $osj2Dusers->user_level->CellAttributes() ?>><span class="phpmaker">
<?php if (!$Security->IsAdmin() && $Security->IsLoggedIn()) { // Non system admin ?>
<div<?php echo $osj2Dusers->user_level->ViewAttributes() ?>><?php echo $osj2Dusers->user_level->EditValue ?></div>
<?php } else { ?>
<select id="x_user_level" name="x_user_level"<?php echo $osj2Dusers->user_level->EditAttributes() ?>>
<!--option value="">Please Select</option-->
<?php
if (is_array($osj2Dusers->user_level->EditValue)) {
	$arwrk = $osj2Dusers->user_level->EditValue;
	$rowswrk = count($arwrk);
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($osj2Dusers->user_level->AdvancedSearch->SearchValue) == strval($arwrk[$rowcntwrk][0])) ? " selected" : "";	
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
			}
}
?>
</select>
<?php
$sSqlWrk = "SELECT `user_level_id`, `user_level_name` FROM `osj-user_level`";
$sSqlWrk .= " WHERE (" . "`user_level_name` != 'Default' AND `user_level_name`!= 'Administrator'" . ")";
$sSqlWrk = TEAencrypt($sSqlWrk, EW_RANDOM_KEY);
?>
<input type="hidden" name="s_x_user_level" id="s_x_user_level" value="<?php echo $sSqlWrk ?>"><input type="hidden" name="lc_x_user_level" id="lc_x_user_level" value="2"><input type="hidden" name="ld1_x_user_level" id="ld1_x_user_level" value="1"><input type="hidden" name="ld2_x_user_level" id="ld2_x_user_level" value="-1"><input type="hidden" name="lft_x_user_level" id="lft_x_user_level" value="1">
<?php } ?>
</span></td>
	</tr>
	<tr class="ewTableAltRow">
		<td class="ewTableHeader">User Status</td>
		<td<?php echo $osj2Dusers->user_status->CellAttributes() ?>><span class="ewSearchOpr">=<input type="hidden" name="z_user_status" id="z_user_status" value="="></span></td>
		<td<?php echo $osj2Dusers->user_status->CellAttributes() ?>><span class="phpmaker">
<select id="x_user_status" name="x_user_status"<?php echo $osj2Dusers->user_status->EditAttributes() ?>>
<!--option value="">Please Select</option-->
<?php
if (is_array($osj2Dusers->user_status->EditValue)) {
	$arwrk = $osj2Dusers->user_status->EditValue;
	$rowswrk = count($arwrk);
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($osj2Dusers->user_status->AdvancedSearch->SearchValue) == strval($arwrk[$rowcntwrk][0])) ? " selected" : "";	
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
			}
}
?>
</select>
</span></td>
	</tr>
</table>
<p>
<input type="submit" name="Action" id="Action" value="  Search  ">
<input type="button" name="Reset" id="Reset" value="   Reset   " onclick="ew_ClearForm(this.form);">
</form>
<script language="JavaScript">
<!--
var f = document.fosj2Duserssearch;
ew_AjaxUpdateOpt(f.x_user_level, f.x_user_level, false);

//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--

// Write your table-specific startup script here
// document.write("page loaded");
//-->

</script>
<?php include "osj-footer.php" ?>
<?php

// If control is passed here, simply terminate the page without redirect
Page_Terminate();

// -----------------------------------------------------------------
//  Subroutine Page_Terminate
//  - called when exit page
//  - clean up connection and objects
//  - if url specified, redirect to url, otherwise end response
function Page_Terminate($url = "") {
	global $conn;

	// Page unload event, used in current page
	Page_Unload();

	// Global page unloaded event (in userfn*.php)
	Page_Unloaded();

	 // Close Connection
	$conn->Close();

	// Go to url if specified
	if ($url <> "") {
		ob_end_clean();
		header("Location: $url");
	}
	exit();
}
?>
<?php

// Build advanced search
function BuildAdvancedSearch() {
	global $osj2Dusers;
	$sSrchUrl = "";

	// Field user_id
	BuildSearchUrl($sSrchUrl, $osj2Dusers->user_id, @$_POST["x_user_id"], @$_POST["z_user_id"], @$_POST["v_user_id"], @$_POST["y_user_id"], @$_POST["w_user_id"]);

	// Field user_creation_date
	BuildSearchUrl($sSrchUrl, $osj2Dusers->user_creation_date, ew_UnFormatDateTime(@$_POST["x_user_creation_date"],6), @$_POST["z_user_creation_date"], @$_POST["v_user_creation_date"], ew_UnFormatDateTime(@$_POST["y_user_creation_date"],6), @$_POST["w_user_creation_date"]);

	// Field user_edit_date
	BuildSearchUrl($sSrchUrl, $osj2Dusers->user_edit_date, ew_UnFormatDateTime(@$_POST["x_user_edit_date"],6), @$_POST["z_user_edit_date"], @$_POST["v_user_edit_date"], ew_UnFormatDateTime(@$_POST["y_user_edit_date"],6), @$_POST["w_user_edit_date"]);

	// Field user_email
	BuildSearchUrl($sSrchUrl, $osj2Dusers->user_email, @$_POST["x_user_email"], @$_POST["z_user_email"], @$_POST["v_user_email"], @$_POST["y_user_email"], @$_POST["w_user_email"]);

	// Field user_level
	BuildSearchUrl($sSrchUrl, $osj2Dusers->user_level, @$_POST["x_user_level"], @$_POST["z_user_level"], @$_POST["v_user_level"], @$_POST["y_user_level"], @$_POST["w_user_level"]);

	// Field user_status
	BuildSearchUrl($sSrchUrl, $osj2Dusers->user_status, @$_POST["x_user_status"], @$_POST["z_user_status"], @$_POST["v_user_status"], @$_POST["y_user_status"], @$_POST["w_user_status"]);
	return $sSrchUrl;
}

// Function to build search URL
function BuildSearchUrl(&$Url, &$Fld, $FldVal, $FldOpr, $FldCond, $FldVal2, $FldOpr2) {
	$sWrk = "";
	$FldParm = substr($Fld->FldVar, 2);
	$FldVal = ew_StripSlashes($FldVal);
	if (is_array($FldVal)) $FldVal = implode(",", $FldVal);
	$FldVal2 = ew_StripSlashes($FldVal2);
	if (is_array($FldVal2)) $FldVal2 = implode(",", $FldVal2);
	$FldOpr = strtoupper(trim($FldOpr));
	if ($FldOpr == "BETWEEN") {
		$IsValidValue = ($Fld->FldDataType <> EW_DATATYPE_NUMBER) ||
			($Fld->FldDataType == EW_DATATYPE_NUMBER && is_numeric($FldVal) && is_numeric($FldVal2));
		if ($FldVal <> "" && $FldVal2 <> "" && $IsValidValue) {
			$sWrk = "x_" . $FldParm . "=" . urlencode($FldVal) .
				"&y_" . $FldParm . "=" . urlencode($FldVal2) .
				"&z_" . $FldParm . "=" . urlencode($FldOpr);
		}
	} elseif ($FldOpr == "IS NULL" || $FldOpr == "IS NOT NULL") {
		$sWrk = "x_" . $FldParm . "=" . urlencode($FldVal) .
			"&z_" . $FldParm . "=" . urlencode($FldOpr);
	} else {
		$IsValidValue = ($Fld->FldDataType <> EW_DATATYPE_NUMBER) ||
			($Fld->FldDataType = EW_DATATYPE_NUMBER && is_numeric($FldVal));
		if ($FldVal <> "" && $IsValidValue && ew_IsValidOpr($FldOpr, $Fld->FldDataType)) {
			$sWrk = "x_" . $FldParm . "=" . urlencode($FldVal) .
				"&z_" . $FldParm . "=" . urlencode($FldOpr);
		}
		$IsValidValue = ($Fld->FldDataType <> EW_DATATYPE_NUMBER) ||
			($Fld->FldDataType = EW_DATATYPE_NUMBER && is_numeric($FldVal2));
		if ($FldVal2 <> "" && $IsValidValue && ew_IsValidOpr($FldOpr2, $Fld->FldDataType)) {
			if ($sWrk <> "") $sWrk .= "&v_" . $FldParm . "=" . urlencode($FldCond) . "&";
			$sWrk .= "&y_" . $FldParm . "=" . urlencode($FldVal2) .
				"&w_" . $FldParm . "=" . urlencode($FldOpr2);
		}
	}
	if ($sWrk <> "") {
		if ($Url <> "") $Url .= "&";
		$Url .= $sWrk;
	}
}
?>
<?php

// Render row values based on field settings
function RenderRow() {
	global $conn, $Security, $osj2Dusers;

	// Call Row Rendering event
	$osj2Dusers->Row_Rendering();

	// Common render codes for all row types
	if ($osj2Dusers->RowType == EW_ROWTYPE_VIEW) { // View row
	} elseif ($osj2Dusers->RowType == EW_ROWTYPE_ADD) { // Add row
	} elseif ($osj2Dusers->RowType == EW_ROWTYPE_EDIT) { // Edit row
	} elseif ($osj2Dusers->RowType == EW_ROWTYPE_SEARCH) { // Search row

		// user_id
		$osj2Dusers->user_id->EditCustomAttributes = "";
		if (!$Security->IsAdmin() && $Security->IsLoggedIn()) { // Non system admin
			$osj2Dusers->user_id->AdvancedSearch->SearchValue = $Security->CurrentUserID();
		$osj2Dusers->user_id->CssStyle = "";
		$osj2Dusers->user_id->CssClass = "";
		$osj2Dusers->user_id->ViewCustomAttributes = "";
		} else {
		}
		$osj2Dusers->user_id->EditCustomAttributes = "";
		if (!$Security->IsAdmin() && $Security->IsLoggedIn()) { // Non system admin
			$osj2Dusers->user_id->AdvancedSearch->SearchValue2 = $Security->CurrentUserID();
		$osj2Dusers->user_id->CssStyle = "";
		$osj2Dusers->user_id->CssClass = "";
		$osj2Dusers->user_id->ViewCustomAttributes = "";
		} else {
		}

		// user_creation_date
		$osj2Dusers->user_creation_date->EditCustomAttributes = "";
		$osj2Dusers->user_creation_date->EditCustomAttributes = "";

		// user_edit_date
		$osj2Dusers->user_edit_date->EditCustomAttributes = "";
		$osj2Dusers->user_edit_date->EditCustomAttributes = "";

		// user_email
		$osj2Dusers->user_email->EditCustomAttributes = "";
		$osj2Dusers->user_email->EditValue = ew_HtmlEncode($osj2Dusers->user_email->AdvancedSearch->SearchValue);
		$osj2Dusers->user_email->EditCustomAttributes = "";
		$osj2Dusers->user_email->EditValue2 = ew_HtmlEncode($osj2Dusers->user_email->AdvancedSearch->SearchValue2);

		// user_level
		$osj2Dusers->user_level->EditCustomAttributes = "";
		if (!$Security->CanAdmin()) { // System admin
			$osj2Dusers->user_level->EditValue = "********";
		} else {
		$sSqlWrk = "SELECT `user_level_id`, `user_level_name` FROM `osj-user_level`";
		if (trim(strval($osj2Dusers->user_level->AdvancedSearch->SearchValue)) == "") {
			$sSqlWrk .= " WHERE 0=1";
		} else {
			$sSqlWrk .= " WHERE `user_level_id` = " . ew_AdjustSql($osj2Dusers->user_level->AdvancedSearch->SearchValue) . "";
		}
		$sSqlWrk .= " AND (" . "`user_level_name` != 'Default' AND `user_level_name`!= 'Administrator'" . ")";
		$rswrk = $conn->Execute($sSqlWrk);
		$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
		if ($rswrk) $rswrk->Close();
		array_unshift($arwrk, array("", "Please Select"));
		$osj2Dusers->user_level->EditValue = $arwrk;
		}

		// user_status
		$osj2Dusers->user_status->EditCustomAttributes = "";
		$arwrk = array();
		$arwrk[] = array("0", "Inactive");
		$arwrk[] = array("1", "Active");
		array_unshift($arwrk, array("", "Please Select"));
		$osj2Dusers->user_status->EditValue = $arwrk;
	}

	// Call Row Rendered event
	$osj2Dusers->Row_Rendered();
}
?>
<?php

// Load advanced search
function LoadAdvancedSearch() {
	global $osj2Dusers;
	$osj2Dusers->user_id->AdvancedSearch->SearchValue = $osj2Dusers->getAdvancedSearch("x_user_id");
	$osj2Dusers->user_id->AdvancedSearch->SearchCondition = $osj2Dusers->getAdvancedSearch("v_user_id");
	$osj2Dusers->user_id->AdvancedSearch->SearchValue2 = $osj2Dusers->getAdvancedSearch("y_user_id");
	$osj2Dusers->user_id->AdvancedSearch->SearchOperator2 = $osj2Dusers->getAdvancedSearch("w_user_id");
	$osj2Dusers->user_creation_date->AdvancedSearch->SearchValue = $osj2Dusers->getAdvancedSearch("x_user_creation_date");
	$osj2Dusers->user_creation_date->AdvancedSearch->SearchValue2 = $osj2Dusers->getAdvancedSearch("y_user_creation_date");
	$osj2Dusers->user_edit_date->AdvancedSearch->SearchValue = $osj2Dusers->getAdvancedSearch("x_user_edit_date");
	$osj2Dusers->user_edit_date->AdvancedSearch->SearchValue2 = $osj2Dusers->getAdvancedSearch("y_user_edit_date");
	$osj2Dusers->user_email->AdvancedSearch->SearchValue = $osj2Dusers->getAdvancedSearch("x_user_email");
	$osj2Dusers->user_email->AdvancedSearch->SearchCondition = $osj2Dusers->getAdvancedSearch("v_user_email");
	$osj2Dusers->user_email->AdvancedSearch->SearchValue2 = $osj2Dusers->getAdvancedSearch("y_user_email");
	$osj2Dusers->user_email->AdvancedSearch->SearchOperator2 = $osj2Dusers->getAdvancedSearch("w_user_email");
	$osj2Dusers->user_level->AdvancedSearch->SearchValue = $osj2Dusers->getAdvancedSearch("x_user_level");
	$osj2Dusers->user_status->AdvancedSearch->SearchValue = $osj2Dusers->getAdvancedSearch("x_user_status");
}
?>
<?php

// Page Load event
function Page_Load() {

	//echo "Page Load";
}

// Page Unload event
function Page_Unload() {

	//echo "Page Unload";
}
?>
